home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / midi / midifl12.lha / midifile.new / noteon.c < prev    next >
C/C++ Source or Header  |  1995-08-27  |  1KB  |  76 lines

  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include "midifile.h"
  4.  
  5.  
  6. FILE *F;
  7. extern long Mf_currtime;
  8.  
  9. /* mygetc : returns <int> with input variables:
  10.  * void:
  11.  */
  12. int mygetc (void)
  13. {
  14.   return (getc (F));
  15. }
  16.  
  17. /* ------------------------------------------------------------------------ */
  18.  
  19. /* mynoteon : returns <int> with input variables:
  20.  * chan:
  21.  * note:
  22.  * velocity:
  23.  */
  24. int mynoteon (
  25.   int chan,
  26.   int note,
  27.   int velocity)
  28. {
  29.   printf ("On: %ld: chan=%d, note=%d, velocity=%d\n", Mf_currtime, chan, note, velocity);
  30. }
  31.  
  32. /* ------------------------------------------------------------------------ */
  33.  
  34. /* mynoteoff : returns <int> with input variables:
  35.  * chan:
  36.  * note:
  37.  * velocity:
  38.  */
  39. int mynoteoff (
  40.   int chan,
  41.   int note,
  42.   int velocity)
  43. {
  44.   printf ("Off: %ld: chan=%d, note=%d, velocity=%d\n", Mf_currtime, chan, note, velocity);
  45. }
  46.  
  47. /* ------------------------------------------------------------------------ */
  48.  
  49.  
  50. /* main : returns <int> with input variables:
  51.  * argc:
  52.  * argv:
  53.  */
  54. int main (
  55.   int argc,
  56.   char **argv)
  57. {
  58.  
  59.  
  60.   if (argc > 1)
  61. F = fopen (argv[1], "r");
  62.   else
  63. F = stdin;
  64.  
  65.   Mf_getc = mygetc;
  66.   Mf_noteon = mynoteon;
  67.   Mf_noteoff = mynoteoff;
  68.  
  69.   midifile ();
  70.  
  71.   exit (0);
  72. }
  73.  
  74. /* ------------------------------------------------------------------------ */
  75.  
  76.